package com.cskaoyan.market.util;

import com.cskaoyan.market.exception.ValidationException;
import org.springframework.validation.BindingResult;

/**
 * @ClassName Validation
 * @Description: TODO
 * @Author 远志 zhangsong@cskaoyan.onaliyun.com
 * @Date 2023/5/20 10:43
 * @Version V1.0
 **/
public class Validation {
    public static void valid(BindingResult bindingResult) {
        if(bindingResult.hasErrors()){
            //返回便不是null
            throw new ValidationException(bindingResult.getFieldError().getDefaultMessage());
        }
    }
}
